/**
 * The CfgMngr configuration interface, for receiving responses from CfgMngr on
 * retrieval configurations, registering/deregistering/locating services
 */
package za.org.jcicada.cfgmngr;

import java.net.URI;
import java.util.Set;

import za.org.jcicada.genss.ServiceURN;
import za.org.jcicada.genss.SystemURN;
import za.org.jcicada.genss.messages.Result;
import za.org.jcicada.genss.sensor.SensorURN;

/**
 * The CfgMngr configuration client interface, allowing the responses on
 * configuration retrieval and registering, deregistering and locating services
 */
public interface IConfigurationClient {
    /**
     * Reply to retrieving the configuration for the subsystem specified
     * 
     * @param result the result of the request
     * @param configuration the object containing the configuration from the
     *            cfgmgnr
     */
    void replyGetConfiguration(Result result, Object configuration);

    /**
     * Handles response to requestLocateService
     * 
     * @param result the result of the request
     * @param serviceURN the service for which a provider is required
     * @param serviceURL the location of the service
     */
    void replyLocateService(Result result, ServiceURN serviceURN, URI locationURI);

    /**
     * Handle service registration response
     * 
     * @param result the result of the request
     * @param locationURI location of the subsystem providing the services
     * @param serviceURN the service the subsystem
     */
    void replyRegisterService(Result result, URI locationURI, ServiceURN serviceURN);

    /**
     * Handle service deregistration response
     * 
     * @param result the result of the request
     * @param locationURI location of the subsystem no longer providing the
     *            services
     * @param serviceURN the service the subsystem is no longer providing
     */
    void replyDeregisterService(Result result, URI locationURI, ServiceURN serviceURN);

    /**
     * Handle service registration response
     * 
     * @param result the result of the request
     * @param reregister flag that requires cfgmgnr to reregister its services
     */
    void replyRegisterSystem(Result result, SystemURN systemURN, boolean reregister);

    /**
     * Handle service deregistration response
     * 
     * @param result the result of the request
     * @param subsystemURL location of the subsystem no longer providing the
     *            services
     * @param serviceURIs the list of services the subsystem is no longer
     *            providing
     */
    void replyDeregisterSystem(Result result, SystemURN systemURN);

    /**
     * Handle system set response
     * 
     * @param result the result of the request
     * @param type the type of system set
     * @param systemURNs the set of registered system names
     */
    void replySystemSet(Result result, SystemSetType type, Set<SystemURN> systemURNs);
    
    /**
     * Handle sensor set response
     * 
     * @param result the result of the request
     * @param systemURN the system for which the sensor set is
     * @param sensorURNs the set of sensor names
     */
    void replySensorSet(Result result, SystemURN systemURN, Set<SensorURN> sensorURNs);
    
    /**
     * Handle service set response
     * 
     * @param result the result of the request
     * @param systemURN the system for which the service set is
     * @param serviceURNs the set of service names
     */
    void replyServiceSet(Result result, SystemURN systemURN, Set<ServiceURN> serviceURNs);

    /**
     * Notify the observer that it has been disconnected from the subject
     */
    void informDisconnect();

}
